home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: news.athene.co.uk!not-for-mail
- From: "C.J. Scaife" <JOLTSWIFT@Athene.co.uk>
- Subject: Re: Help with calling batch files from Borland C++
- Message-ID: <3151DBDB.266B@Athene.co.uk>
- Date: Thu, 21 Mar 1996 22:44:43 +0000
- References: <ragnaroek1996Mar20.184656.11284@news2.compulink.com>
- Organization: JoltSwift Ltd.
- X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
- MIME-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
-
- Chantal Marier wrote:
- >
- > I am hoping that someone will be able to help me with a program that I have
- > made. It almost works except for the fact that it only reads the batch file in
- > question instead of calling the batch file. I am using Borland C++ and my
- > program follows.
- >
- > #include <stdio.h>
- >
- > FILE *filePtr; /* Defines a file
- > pointer */
- >
- > main()
- > {
- > filePtr = fopen("menu.bat", "r"); /* Opens file for
- > reading */
- > if (filePtr == NULL)
- > { printf("Error opening file.\n"); } /* Displays error
- > message if file does not
- > open */
- > else
- > { fclose(filePtr); /* Closes file */
- > printf("Program complete.\n"); }
- > return 0;
- > }
- >
- > If anyone out there knows how to do what I need to do, please, PLEASE let me
- > know how to do this darn program. I am just learning how to program and your
- > help would be greatly appreciated. :)
-
- Dos batch files are interpreted by the command line interpreter
- Command.Com. You should look at the system() function in your standard
- library documentation and you will find it does what you want and also
- works on unix systems etc...
- --
- Written by Chris Scaife.
- For more details see my home page:
- http://www.Athene.co.uk/Joltswift/P1.htm
-
-